package captcha_v1

import (
	"context"
	v1 "gf-xb-api/api/captcha/v1"
	"gf-xb-api/utility/xcaptcha"
)

func (s *sCaptcha) Create(ctx context.Context) (res *v1.CreateRes, err error) {

	captchaId, captchaCode, err := xcaptcha.New()
	if err != nil {
		return nil, err
	}

	res = &v1.CreateRes{
		CaptchaId:   captchaId,
		CaptchaCode: captchaCode,
	}

	return res, nil
}
